﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AdinZ.Web.UI;
/**
* @Author: AdinZ
* @Q  Q : 1454269
* @Email:adinz@adinz.com
* @Created: 2014/3/31 22:12:59
* */
namespace Web.admin
{
    public partial class article :Admin_BasePage
    {
        private string vAct = "";
        private int vPage = 1;
        private int vID;
        private int vTypeID = 0;
        private string vSQL = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            vAct = Request.QueryString["Act"] != null ? Request.QueryString["Act"] : "";
            vTypeID = Request.QueryString["typeid"] != null ? int.Parse(Request.QueryString["typeid"]) : 0;

            vAct = Request.QueryString["Act"] != null ? Request.QueryString["Act"] : "";
            if (Request.QueryString["Page"] != null && Request.QueryString["Page"].Trim() != "")
            {
                if (!int.TryParse(Request.QueryString["Page"], out vPage))
                {
                    vPage = 1;
                }
            }
            if (Request.QueryString["ID"] != null && Request.QueryString["ID"].Trim() != "")
            {
                if (!int.TryParse(Request.QueryString["ID"], out vID))
                {
                    Response.Write("ID Error");
                    Response.End();
                }
            }
            vSQL = "1=1";
            if (vTypeID != 0)
            {
                vSQL += "AND [tid]='"+vTypeID+"'";
            }
            getPageList();
        }

        protected void getPageList()
        {
            int vPageSize = 10;
            int vCount = __bll_art.GetCount(vSQL);
            repRecordList.DataSource = __bll_art.GetListByPage(vSQL, "ID Desc", (vPage - 1) * vPageSize, vPage * vPageSize);
            repRecordList.DataBind();
            string pTemp = "";
            int vPageCount = 1;
            if (vCount > 0)
            {
                vPageCount = (int)Math.Ceiling((double)vCount / (double)vPageSize);
                pTemp = PageList.GetPagingInfo_Manage(vPageCount, vCount, vPage, vPageSize);
            }

            this.pagelist.InnerHtml = pTemp;
        }

    }
}